package net;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

import logic.GameRules;
import logic.Manager;

public class GameServer implements Runnable{
	public GameRules gameRules;
	public Socket socket;
	public Thread serverThread;
	public ServerSocket server;
	public Manager gameManager;
	
	public static boolean isactive = false;
	public GameServer(){
		gameManager = new Manager(2);
		gameRules = new GameRules();
		serverThread = new Thread(this);
		serverThread.start();
	}
	
	public void initServer(){
		try{
			server = new ServerSocket(9999);
			socket = server.accept();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public void run() {
		while(Thread.currentThread().equals(serverThread)){
			if(!isactive){
				initServer();
				isactive = true;
			}
			System.out.println("in run");
		}
	}
}
